export const ConstVal = 123
export const ConstObj = {
  name: '123',
  age: 12
}
function toString(num) {
  try {
    return num.toString()
  } catch (error) {
    return ''
  }
}

export function toNumber(str) {
  try {
    return Number(str)
  } catch (error) {
    return 0
  }
}

export function consoleObj(obj) {
  console.log(obj)
}

export class Student {
  name
  constructor(name) {
    this.name = name
  }
  getName(prefix) {
    console.log(`${prefix || ''}${this.name}`)
  }
}

export function parseDirection(direction) {
  return {
    'up': 1,
    'down': 2,
    'left': 3,
    'right': 4,
  }[direction]
}

export const arrowFunction = str => {
  return `prefix_${str}`
}

export default toString